/**
 * 
 */
package com.swim.natatoriumapply.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.swim.natatoriumapply.entity.NatatoriumApply;
import com.swim.natatoriumapply.dao.NatatoriumApplyDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 游泳馆申请Service
 * @author 刘军武
 * @version 2021-01-26
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class NatatoriumApplyService extends CrudService<NatatoriumApplyDao, NatatoriumApply> {

	/**
	 * 获取单条数据
	 * @param natatoriumApply
	 * @return
	 */
	@Override
	public NatatoriumApply get(NatatoriumApply natatoriumApply) {
		return super.get(natatoriumApply);
	}

	/**
	 * 查询分页数据
	 * @param page 分页对象
	 * @param natatoriumApply
	 * @return
	 */
	@Override
	public Page<NatatoriumApply> findPage(Page<NatatoriumApply> page, NatatoriumApply natatoriumApply) {
		return super.findPage(page, natatoriumApply);
	}

	/**
	 * 保存数据（插入或更新）
	 * @param natatoriumApply
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(NatatoriumApply natatoriumApply) {
		natatoriumApply.setApplyState(1L);
		super.save(natatoriumApply);
		// 保存营业执照图片
		FileUploadUtils.saveFileUpload(natatoriumApply.getId(), "business_license_image");
		// 保存高危证图片
		FileUploadUtils.saveFileUpload(natatoriumApply.getId(), "high_risk_image");
	}

	/**
	 * 更新状态
	 * @param natatoriumApply
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(NatatoriumApply natatoriumApply) {
		super.updateStatus(natatoriumApply);
	}

	/**
	 * 删除数据
	 * @param natatoriumApply
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(NatatoriumApply natatoriumApply) {
		super.delete(natatoriumApply);
	}

}